﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Warehouse.DB
{
    public class SqlSugarDbContext
    {
        private SqlSugarClient _db;

        public SqlSugarDbContext()
        {
            // 创建 SqlSugar 实例，并配置连接字符串
            _db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = "data source =" + System.AppDomain.CurrentDomain.BaseDirectory + "DeviceData\\DB_Data.sqlite", // 数据库连接字符串
                DbType = SqlSugar.DbType.Sqlite, // 指定数据库类型，SqlServer
                IsAutoCloseConnection = true // 自动关闭连接
            });
        }

        public SqlSugarClient Db => _db;  // 提供 Db 操作实例
    }
}
